import React from 'react';
import styled from 'styled-components';
import 'helper.scss'

const importAll = (requireContext: __WebpackModuleApi.RequireContext) => {requireContext.keys().forEach(requireContext)}
try {importAll(require.context('icons/', true, /\.svg$/));} catch(error) {console.log(error)}

const Svg = styled.svg`
  --color-1: #2966C1;
  --color-2: #FD9A16;
  height: 24px;
  width: 24px;
  //transition: all 1s ease;
`

type Props = {
    name: string
}

const Icon:React.FC<Props> = (props) => {
    return (
        <Svg className="icon">
            <use xlinkHref={'#' + props.name}/>
        </Svg>
    )
}

export default Icon